<?php
require_once("lib/curl.php");
require_once("config.php");

Doctrine::loadModels('models');

$player = 'Oakie';

$raiderTable = Doctrine::getTable('Raider');

$raidTable = Doctrine::getTable('Raid');

$raids = Doctrine_Query::create()
          ->from('Raid r')
	  ->leftJoin('r.Raider p')
	  ->execute();

print("Total raids: " . sizeof($raids) . "\r\n" );

foreach($raids as $raid) {
     	print $raid->zone . " has raiders: \r\n";
	foreach($raid->Raider as $raider) {
		print "     " . $raider->name . "\r\n";
	}
}

$raiders = Doctrine::getTable('Raider')->findAll();

$oakieraids = Doctrine_Query::Create()
		->from('RaidRaider r')
		->where('r.raider_id = "Oakie"')
		->execute();

print("# raids for Oakie: " . sizeof($oakieraids));

?>
